<template>
  <div class="web">
    <div class="webLeft">
      <menuleft :menuList="menuList" :menuFlag="menuFlag" @handleMenu="handleMenu" />
    </div>
    <div class="webRight">
      <station :menuFlag="menuFlag" v-show="this.$route.path == '/company' && menuFlag !== '10'" />
      <router-view></router-view>
    </div>
  </div>
</template>
<script>
import station from "./station";
import menuleft from "@/components/menuItem/menuleft.vue";
import docstatu from "@/views/page/document/documentStation.vue";
import {
  fresh,
  startBackupData,
  getUserAuthResourceList,
} from "@/service/Api.js"; // 接口
import { mapState } from "vuex";

export default {
  components: { station, menuleft, docstatu },
  name: "companyMent",
  data() {
    return {
      activeName: "first",
      menuList: [
        {
          name: "公司管理",
          id: "4",
          children: [],
        },
      ],
      menuFlag: "", //13-首个菜单-14-第二个菜单--依次规律
    };
  },
  computed: {
    ...mapState(["menuId"]),
  },
  methods: {
    handleClick(tab, event) {},
    handleMenu(id) {
      this.menuFlag = id;
      this.$router.push({ path: "/company" }); //点击侧边栏  返回到公司管理页面
    },

    init() {
      // 获取当前角色下的二级列表
      getUserAuthResourceList(this.menuList[0].id).then((res) => {
        if (res.code == 0) {
          this.menuList[0].children = res.data;
          this.menuFlag = res.data[0].id.toString();
        } else {
          this.$message.error(`${res.data}`);
        }
      });
    },
  },
  created() {
    this.init();
  },
};
</script>

<style scoped>
.search {
  display: flex;
}
.search .el-button:first-child {
  margin-right: 20px !important;
}
#menu {
  position: fixed;
}
</style>
